package csc.fresher.finalgroupfour.controller;

import java.io.IOException;

import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

@Controller
public class LoginController {

	@RequestMapping(value = "/login", method = RequestMethod.GET)
	public ModelAndView welcome(HttpServletRequest request) throws IOException {

		ModelAndView model = new ModelAndView("login");

		String errorString = request.getParameter("error");
		if (errorString == null) {
			request.getSession().setAttribute("errorMessage", null);
		}
		return model;
	}

	@RequestMapping(value = "/403")
	public String denyAccess() {
		return "view403";
	}

}
